﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:rpncs"
    xmlns:my="clr-namespace:System;assembly=mscorlib" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
    x:Class="rpncs.MainPage"
    mc:Ignorable="d"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True" d:DesignHeight="768" d:DesignWidth="480">
    <phone:PhoneApplicationPage.Resources>
        <local:InputConverter x:Key="input"/>
        <local:Calc x:Key="calc"/>
        <my:Double x:Key="EnterKeyWidth">146</my:Double>
        
        <Color x:Key="ExponentColorKey">SteelBlue</Color>
        <Color x:Key="DarkBlueColorKey">DarkCyan</Color>
        <SolidColorBrush x:Key="DarkBlueVioletBrushKey">DarkSlateBlue</SolidColorBrush>
        <SolidColorBrush x:Key="DarkBlueVioletBrushKey1">Indigo</SolidColorBrush>
        <my:Double x:Key="ButtonFontSize">20.333</my:Double>
        <local:MultiFunctionButton x:Key="MultiFunctionBtn"/>
        <my:Double x:Key="TrigBtnFontSize">18.333</my:Double>
        <my:Double x:Key="NormalButtonWidth">91</my:Double>
        <my:Double x:Key="TopButtonHeight">70</my:Double>
    </phone:PhoneApplicationPage.Resources>
    
        <!--LayoutRoot is the root grid where all page content is placed-->

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->
   
    <phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
        	<RowDefinition Height="Auto"/>
        	<RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,0,0" HorizontalAlignment="Left" Width="456">
            <TextBlock Height="60" HorizontalAlignment="Center" Margin="0,6,0,0" x:Name="entryArea" Text="" VerticalAlignment="Top" Width="441" Style="{StaticResource PhoneTextSmallStyle}" />
            <TextBox Height="72" HorizontalAlignment="Center" Margin="0,6,0,0" x:Name="entryValues" Text="" VerticalAlignment="Top" Width="460" InputScope="Number" />
            <Canvas Margin="32,199,0,0" VerticalAlignment="Top" Height="74">
            	<Button Content="+/-" x:Name="sign" BorderThickness="1" Background="Teal" Click="sign_Click" FontSize="20.333" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Canvas.Left="11" Canvas.Top="6" Height="61">
            		<Button.Width>
            			<my:Double>91</my:Double>
            		</Button.Width>
                </Button>
            	<ToggleButton x:Name="shift" Foreground="#FF211612" Tag="fnKey" BorderThickness="2" Background="#FFCF8716" ClickMode="Press" Content="SHIFT" ToolTipService.ToolTip="Switch button functions" Padding="5" FontSize="22" d:LayoutOverrides="VerticalAlignment" Canvas.Left="103" Width="105" Canvas.Top="0" Click="shift_Click" Height="{StaticResource TopButtonHeight}" />
            	<Button Background="Maroon" CommandParameter="C" Content="C" x:Name="clear" Width="76" Click="clear_Click" Height="{StaticResource TopButtonHeight}" Canvas.Left="194" Canvas.Top="0" Padding="1" HorizontalAlignment="Stretch"/>
            	<Button Content="ENTER" x:Name="enterKey" Width="{StaticResource EnterKeyWidth}" ClickMode="Release"  Click="OnEnterButtonClick" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Height="{StaticResource TopButtonHeight}" Canvas.Left="254" Canvas.Top="0" Padding="1,5" BorderThickness="2" />
            </Canvas>
            <ScrollViewer Height="109" Margin="15,84,3,0" x:Name="result" VerticalAlignment="Top" Foreground="#FFFFFA00" VerticalContentAlignment="Top" HorizontalContentAlignment="Right" VerticalScrollBarVisibility="Visible" Background="#FF0003FF"/>
            <Grid x:Name="mainButtonGrid" Margin="15,277,8,0" Background="#FF1A1818" HorizontalAlignment="Center" Width="433" VerticalAlignment="Top" Height="337">
            	<Grid.RowDefinitions>
            		<RowDefinition Height="Auto" x:Name="arith" />
            		<RowDefinition Height="Auto" x:Name="fn" />
            		<RowDefinition Height="Auto" x:Name="trig" />
            		<RowDefinition Height="Auto" x:Name="aux" />
            	</Grid.RowDefinitions>
            	<StackPanel x:Name="arithPanel" Orientation="Horizontal" Background="#FF666565" AllowDrop="False" RenderTransformOrigin="0.489,1.636" Margin="18,0,16,7" HorizontalAlignment="Center" Width="377">
            		<Button BorderThickness="1" Content="x" x:Name="multiply" Click="multiply_Click" FontWeight="Bold" FontSize="{StaticResource ButtonFontSize}" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5" Background="{StaticResource DarkBlueVioletBrushKey}" FontFamily="Segoe WP"></Button>
            		<Button BorderThickness="1" Content="-" x:Name="minus" Background="{StaticResource DarkBlueVioletBrushKey}" Click="minus_Click" FontWeight="Bold" FontSize="{StaticResource ButtonFontSize}" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5"></Button>
            		<Button BorderThickness="1" Content="/" x:Name="divide" Background="{StaticResource DarkBlueVioletBrushKey}" Click="divide_Click" FontWeight="Bold" FontSize="{StaticResource ButtonFontSize}" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5"></Button>
            		<Button Content="+" x:Name="plus" BorderThickness="1" Background="{StaticResource DarkBlueVioletBrushKey}" Click="plus_Click" CommandParameter="plus" FontWeight="Bold" FontSize="{StaticResource ButtonFontSize}" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5"></Button>
            	</StackPanel>
            	<StackPanel Margin="0,-3,0,8" x:Name="exponentPanel" Orientation="Horizontal" HorizontalAlignment="Center" Width="377" Grid.Row="1">
            		<Button BorderThickness="1" Content="y^x" x:Name="xExpY" FontStretch="Condensed" IsEnabled="True" Click="xExpY_Click" FontStyle="Italic" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="5" Background="{StaticResource DarkBlueVioletBrushKey1}" FontSize="{StaticResource ButtonFontSize}" FontFamily="Segoe WP"></Button>
            		<Button Background="{StaticResource DarkBlueVioletBrushKey1}" BorderThickness="1" x:Name="eExp" FontSize="{StaticResource ButtonFontSize}" Click="eExp_Click" Content="e^x" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5" FontStyle="Italic" FontFamily="Segoe WP"></Button>
            		<Button Background="{StaticResource DarkBlueVioletBrushKey1}" BorderThickness="1" Content="sqrt" FontSize="{StaticResource ButtonFontSize}" FontStyle="Normal" x:Name="sqrt" Click="sqrt_Click" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5"></Button>
            		<Button Background="{StaticResource DarkBlueVioletBrushKey1}" BorderThickness="1" Content="LN" FontSize="{StaticResource ButtonFontSize}" FontStyle="Normal" x:Name="ln" Click="ln_Click" Width="{StaticResource NormalButtonWidth}" Height="65" Padding="10,5"></Button>
            	</StackPanel>
                <StackPanel Height="66" HorizontalAlignment="Center" Orientation="Horizontal" Margin="29,6,27,0" x:Name="trigPanel" VerticalAlignment="Top" Width="377" RenderTransformOrigin="0.486,-0.602" Grid.Row="2">
                    <Button Click="sin_Click" Content="SIN" x:Name="sin" Width="{StaticResource NormalButtonWidth}" BorderThickness="1" CommandParameter="sin" Height="65" Padding="10,5" Background="MidnightBlue" FontSize="{StaticResource TrigBtnFontSize}"></Button>
                    <Button Click="cos_Click" BorderThickness="1" CommandParameter="cos" Content="COS" x:Name="cos" Width="{StaticResource NormalButtonWidth}" FontSize="{StaticResource TrigBtnFontSize}" Height="65" Padding="10,5" Background="MidnightBlue"></Button>
                    <Button  Click="tan_Click" BorderThickness="1" CommandParameter="tan" Content="TAN" x:Name="tan" Width="{StaticResource NormalButtonWidth}" FontSize="{StaticResource TrigBtnFontSize}" Height="65" Padding="10,5" Background="MidnightBlue"></Button>
                    <Button BorderThickness="1" CommandParameter="hyp" Content="HYP" x:Name="hyp" Width="{StaticResource NormalButtonWidth}" FontSize="{StaticResource TrigBtnFontSize}" Height="65" Padding="10,5" Background="MidnightBlue" ClickMode="Press" Click="hyp_Click"></Button>
                </StackPanel>
                <StackPanel x:Name="auxPanel" Margin="0,4,27,0" Orientation="Horizontal" Background="#FF1A1818" Grid.Row="3" RenderTransformOrigin="0.321,0.379" VerticalAlignment="Top" HorizontalAlignment="Right" Width="377">
                	<Button x:Name="x2dec" Content="1/x" Background="#FF0BA850" BorderThickness="1" Width="{StaticResource NormalButtonWidth}" Height="65" FontSize="{StaticResource ButtonFontSize}" Click="E_Click" FontFamily="Segoe WP" FontStyle="Italic"></Button>
                	<Button x:Name="switchVars" Content="x | y" Background="#FF0BA850" FontStyle="Italic" FontSize="{StaticResource ButtonFontSize}" Margin="0" Padding="5"  BorderThickness="1" Width="{StaticResource NormalButtonWidth}" Height="65" FontFamily="Segoe WP" Click="switchVars_Click"></Button>
                	<Button x:Name="pi" Content="π" Background="#FF0BA850" FontStyle="Italic" FontSize="{StaticResource ButtonFontSize}" Margin="0,0.5" Padding="5"  BorderThickness="1" Width="{StaticResource NormalButtonWidth}" Height="65" Click="pi_Click"></Button>
                	<Button x:Name="factorial" Content="x!" Background="#FF0BA850" FontSize="{StaticResource ButtonFontSize}" Margin="0,0.5" Padding="2"  BorderThickness="1" Width="{StaticResource NormalButtonWidth}" Height="65" Click="factorial_Click" FontFamily="Segoe WP" FontStyle="Italic"></Button>
                </StackPanel>
            </Grid>
        </Grid>
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="RPN Calculator" Style="{StaticResource PhoneTextNormalStyle}" Foreground="#FFC85614" HorizontalAlignment="Left" Margin="12,0,0,5" Width="145"/>
            <TextBlock x:Name="PageTitle" Text="RPN Scientific" Margin="0,-10,129,5" Style="{StaticResource PhoneTextTitle1Style}" Height="82" VerticalAlignment="Bottom" FontSize="48" FontFamily="Arial" FontStyle="Italic" HorizontalAlignment="Center"/>
        </StackPanel>
        <!--ContentPanel - place additional content here-->
    </Grid>

</phone:PhoneApplicationPage>